#include <map>
#include <iostream>
#include <string>
#include <glibmm/ustring.h>
using namespace std;
using namespace Glib;

string punct =".,!#$%^&*<>?/|][}{=+)(";
int main (int argc, char ** argu){

 map <string,int> m;
 
string word;
while (cin >> word){
 ustring u=word;
 word=u.lowercase();
 //cout<<word<< " ";
 
 size_t t; 
 t=punct.find (word[0]);
 if (t!=string::npos) {
   //cerr << "! " << word << endl;
   word=word.substr(1,word.size()-1);
 }

 t=punct.find (word[word.size()-1]);
 if (t!=string::npos)
   word=word.substr(0,word.size()-1);

 
  if (m.find(word) !=m.end())
  m[word]++;
  else 
  m[word]=1;
}

 map <string,int>::iterator it=m.begin();
 while (m.end()!=it){
 cout <<it->first<<" "<<it->second<< endl;
 it++;
}
return 0;
} 
